package com.sl.au.service.impl;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.service.ExdeChartsService;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Service("ExdeChartsService")
@Transactional
public class ExdeChartsServiceImpl implements ExdeChartsService{
	@PersistenceContext
	private EntityManager em;
	
	
	@Override
	public List getContractChartsService(int queryType, String dateField, String beginDate, String endDate,
			String deptName) {
			return this.em.createNativeQuery("{call getContractChart(?,?,?,?,?)}")
					.setParameter(1, queryType)
					.setParameter(2, dateField)
					.setParameter(3, beginDate)
					.setParameter(4, endDate == null ? "" : endDate)
					.setParameter(5, deptName == null ? "" : deptName)
					.getResultList();
	}
	
}
